class Solution:
    def removeOccurrences(self, s: str, part: str) -> str:
        i = s.find(part)
        while i >= 0:
            s = s[:i] + s[i + len(part):]
            i = s.find(part)
        return s


if __name__ == "__main__":
    print(Solution().removeOccurrences(s="daabcbaabcbc", part="abc"))  # dab
    print(Solution().removeOccurrences(s="axxxxyyyyb", part="xy"))  # ab
    print(Solution().removeOccurrences(s="aabababa", part="aba"))  # ba
